define('XOR_KEY', 73897762); //Random key for using in encryption

/**
 * Encrypt decimal number
 * @param $Number (max value 999.999.999)
 * @return string
 */
function EncryptNumber($Number) {

    $Key    = str_pad(decbin(XOR_KEY),    32, "0", STR_PAD_LEFT);
    $Number    = str_pad(decbin($Number),    32, "0", STR_PAD_LEFT);

    $Bit = bitxor($Key, $Number);
    $Dec = bindec($Bit);

    $Base36 = base_convert($Dec,10,36);

    return strtoupper($Base36);
}
/**
 * Decrypt an encrypted decimal number
 * @param $String
 * @return bool|number|string
 */
function DecryptNumber($String) {

    $Dec = base_convert($String,36,10);

    $Key    = str_pad(decbin(XOR_KEY),    32, "0", STR_PAD_LEFT);
    $String    = str_pad(decbin($Dec),        32, "0", STR_PAD_LEFT);

    $Bit = bitxor($Key,$String);
    $Dec = bindec($Bit);

    return $Dec;
}
function bitxor($o1, $o2) {
    $xorWidth = PHP_INT_SIZE*8;
    $o1 = str_split($o1, $xorWidth);
    $o2 = str_split($o2, $xorWidth);
    $res = '';
    $runs = count($o1);
    for($i=0;$i<$runs;$i++)
        $res .= decbin(bindec($o1[$i]) ^ bindec($o2[$i]));
    return $res;
}

//Test
$e = EncryptNumber(43429);
var_dump($e);
$d = DecryptNumber($e);
var_dump($d);

